home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Visual Basic 6.0 Utilities / Multi-Language Add-In for Visual Basic 6.0 / MultiLang.msi / _AF3F81C34EF811D5BEBE0020182C1E5C (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-08-31  |  9.6 KB  |  225 lines

  1. VERSION 5.00
  2. Begin VB.Form frmAbout 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "About SimpleEditor"
  5.    ClientHeight    =   3636
  6.    ClientLeft      =   36
  7.    ClientTop       =   336
  8.    ClientWidth     =   5892
  9.    ClipControls    =   0   'False
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   3636
  14.    ScaleWidth      =   5892
  15.    ShowInTaskbar   =   0   'False
  16.    StartUpPosition =   1  'CenterOwner
  17.    Tag             =   "About SimpleEditor"
  18.    Begin VB.PictureBox picIcon 
  19.       AutoSize        =   -1  'True
  20.       BackColor       =   &H00C0C0C0&
  21.       ClipControls    =   0   'False
  22.       Height          =   432
  23.       Left            =   240
  24.       Picture         =   "frmAbout.frx":0000
  25.       ScaleHeight     =   374.634
  26.       ScaleMode       =   0  'User
  27.       ScaleWidth      =   374.634
  28.       TabIndex        =   2
  29.       TabStop         =   0   'False
  30.       Top             =   240
  31.       Width           =   432
  32.    End
  33.    Begin VB.CommandButton cmdOK 
  34.       Cancel          =   -1  'True
  35.       Caption         =   "OK"
  36.       Default         =   -1  'True
  37.       Height          =   345
  38.       Left            =   4245
  39.       TabIndex        =   0
  40.       Tag             =   "OK"
  41.       Top             =   2625
  42.       Width           =   1467
  43.    End
  44.    Begin VB.CommandButton cmdSysInfo 
  45.       Caption         =   "&System Info..."
  46.       Height          =   345
  47.       Left            =   4260
  48.       TabIndex        =   1
  49.       Tag             =   "&System Info..."
  50.       Top             =   3075
  51.       Width           =   1452
  52.    End
  53.    Begin VB.Label lblDescription 
  54.       Caption         =   "This is a simple editor, based on a TextBox control. It is part of a tutorial for the Multi-Language Add-In for Visual Basic 6.0"
  55.       ForeColor       =   &H00000000&
  56.       Height          =   1170
  57.       Left            =   1050
  58.       TabIndex        =   6
  59.       Tag             =   "App Description"
  60.       Top             =   1125
  61.       Width           =   4092
  62.    End
  63.    Begin VB.Label lblTitle 
  64.       Caption         =   "SimpleEditor"
  65.       ForeColor       =   &H00000000&
  66.       Height          =   480
  67.       Left            =   1050
  68.       TabIndex        =   5
  69.       Tag             =   "Application Title"
  70.       Top             =   240
  71.       Width           =   4092
  72.    End
  73.    Begin VB.Line Line1 
  74.       BorderColor     =   &H00808080&
  75.       BorderStyle     =   6  'Inside Solid
  76.       Index           =   1
  77.       X1              =   225
  78.       X2              =   5657
  79.       Y1              =   2430
  80.       Y2              =   2430
  81.    End
  82.    Begin VB.Line Line1 
  83.       BorderColor     =   &H00FFFFFF&
  84.       BorderWidth     =   2
  85.       Index           =   0
  86.       X1              =   240
  87.       X2              =   5657
  88.       Y1              =   2445
  89.       Y2              =   2445
  90.    End
  91.    Begin VB.Label lblVersion 
  92.       Caption         =   "Version"
  93.       Height          =   225
  94.       Left            =   1050
  95.       TabIndex        =   4
  96.       Tag             =   "Version"
  97.       Top             =   780
  98.       Width           =   4092
  99.    End
  100.    Begin VB.Label lblDisclaimer 
  101.       Caption         =   "Warning: This program is not intended for serious use."
  102.       ForeColor       =   &H00000000&
  103.       Height          =   825
  104.       Left            =   255
  105.       TabIndex        =   3
  106.       Tag             =   "Warning: ..."
  107.       Top             =   2625
  108.       Width           =   3870
  109.    End
  110. Attribute VB_Name = "frmAbout"
  111. Attribute VB_GlobalNameSpace = False
  112. Attribute VB_Creatable = False
  113. Attribute VB_PredeclaredId = True
  114. Attribute VB_Exposed = False
  115. Option Explicit
  116. ' Reg Key Security Options...
  117. Const KEY_ALL_ACCESS = &H2003F
  118.                      
  119. ' Reg Key ROOT Types...
  120. Const HKEY_LOCAL_MACHINE = &H80000002
  121. Const ERROR_SUCCESS = 0
  122. Const REG_SZ = 1                         ' Unicode nul terminated string
  123. Const REG_DWORD = 4                      ' 32-bit number
  124. Const gREGKEYSYSINFOLOC = "SOFTWARE\Microsoft\Shared Tools Location"
  125. Const gREGVALSYSINFOLOC = "MSINFO"
  126. Const gREGKEYSYSINFO = "SOFTWARE\Microsoft\Shared Tools\MSINFO"
  127. Const gREGVALSYSINFO = "PATH"
  128. Private Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, ByRef phkResult As Long) As Long
  129. Private Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, ByRef lpType As Long, ByVal lpData As String, ByRef lpcbData As Long) As Long
  130. Private Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Long) As Long
  131. Private WithEvents ml_RuntimeSupport As MLRUNTIMELib.MLSupport
  132. Attribute ml_RuntimeSupport.VB_VarHelpID = -1
  133. Private Sub Form_Load()
  134.   Set ml_RuntimeSupport = New MLSupport
  135.   ml_UpdateControls
  136.   lblVersion.Caption = ml_string(48, "Version ") & App.Major & "." & App.Minor & "." & App.Revision
  137.   lblTitle.Caption = App.Title
  138. End Sub
  139. Private Sub cmdSysInfo_Click()
  140.     Call StartSysInfo
  141. End Sub
  142. Private Sub cmdOK_Click()
  143.     Unload Me
  144. End Sub
  145. Public Sub StartSysInfo()
  146.   On Error GoTo SysInfoErr
  147.     Dim rc As Long
  148.     Dim SysInfoPath As String
  149.     ' Try To Get System Info Program Path\Name From Registry...
  150.     If GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFO, gREGVALSYSINFO, SysInfoPath) Then
  151.     ' Try To Get System Info Program Path Only From Registry...
  152.     ElseIf GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFOLOC, gREGVALSYSINFOLOC, SysInfoPath) Then
  153.         ' Validate Existance Of Known 32 Bit File Version
  154.         If (Dir(SysInfoPath & "\MSINFO32.EXE") <> "") Then
  155.             SysInfoPath = SysInfoPath & "\MSINFO32.EXE"
  156.             
  157.         ' Error - File Can Not Be Found...
  158.         Else
  159.             GoTo SysInfoErr
  160.         End If
  161.     ' Error - Registry Entry Can Not Be Found...
  162.     Else
  163.         GoTo SysInfoErr
  164.     End If
  165.     Call Shell(SysInfoPath, vbNormalFocus)
  166.     Exit Sub
  167. SysInfoErr:
  168.     MsgBox "System Information Is Unavailable At This Time", vbOKOnly
  169. End Sub
  170. Public Function GetKeyValue(KeyRoot As Long, KeyName As String, SubKeyRef As String, ByRef KeyVal As String) As Boolean
  171.     Dim i As Long                                           ' Loop Counter
  172.     Dim rc As Long                                          ' Return Code
  173.     Dim hKey As Long                                        ' Handle To An Open Registry Key
  174.     Dim hDepth As Long                                      '
  175.     Dim KeyValType As Long                                  ' Data Type Of A Registry Key
  176.     Dim tmpVal As String                                    ' Tempory Storage For A Registry Key Value
  177.     Dim KeyValSize As Long                                  ' Size Of Registry Key Variable
  178.     '------------------------------------------------------------
  179.     ' Open RegKey Under KeyRoot {HKEY_LOCAL_MACHINE...}
  180.     '------------------------------------------------------------
  181.     rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey) ' Open Registry Key
  182.     If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError          ' Handle Error...
  183.     tmpVal = String$(1024, 0)                             ' Allocate Variable Space
  184.     KeyValSize = 1024                                       ' Mark Variable Size
  185.     '------------------------------------------------------------
  186.     ' Retrieve Registry Key Value...
  187.     '------------------------------------------------------------
  188.     rc = RegQueryValueEx(hKey, SubKeyRef, 0, KeyValType, tmpVal, KeyValSize)    ' Get/Create Key Value
  189.                         
  190.     If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError          ' Handle Errors
  191.     tmpVal = VBA.Left(tmpVal, InStr(tmpVal, VBA.Chr(0)) - 1)
  192.     '------------------------------------------------------------
  193.     ' Determine Key Value Type For Conversion...
  194.     '------------------------------------------------------------
  195.     Select Case KeyValType                                  ' Search Data Types...
  196.     Case REG_SZ                                             ' String Registry Key Data Type
  197.         KeyVal = tmpVal                                     ' Copy String Value
  198.     Case REG_DWORD                                          ' Double Word Registry Key Data Type
  199.         For i = Len(tmpVal) To 1 Step -1                    ' Convert Each Bit
  200.             KeyVal = KeyVal + Hex(Asc(Mid(tmpVal, i, 1)))   ' Build Value Char. By Char.
  201.         Next
  202.         KeyVal = Format$("&h" + KeyVal)                     ' Convert Double Word To String
  203.     End Select
  204.     GetKeyValue = True                                      ' Return Success
  205.     rc = RegCloseKey(hKey)                                  ' Close Registry Key
  206.     Exit Function                                           ' Exit
  207. GetKeyError:    ' Cleanup After An Error Has Occured...
  208.     KeyVal = ""                                             ' Set Return Val To Empty String
  209.     GetKeyValue = False                                     ' Return Failure
  210.     rc = RegCloseKey(hKey)                                  ' Close Registry Key
  211. End Function
  212. Private Sub ml_UpdateControls()
  213.   Me.Caption = ml_string(36)
  214.   cmdOK.Caption = ml_string(37)
  215.   cmdSysInfo.Caption = ml_string(38)
  216.   lblDescription.Caption = ml_string(39)
  217.   lblDisclaimer.Caption = ml_string(42)
  218.   lblTitle.Caption = ml_string(40)
  219.   lblVersion.Caption = ml_string(41)
  220. End Sub
  221. Private Sub ml_RuntimeSupport_LanguageChanged(ByVal LanguageID As Long, ByVal Language As String)
  222.   ml_ChangeLanguage LanguageID, Language
  223.   ml_UpdateControls
  224. End Sub
  225.